<template>
	<view>
		<view class="page">
		   <comp-common v-bind="{data:data}"></comp-common>
		    <comp-header v-bind="{data:data}"></comp-header>
		    <view class="body after-navber">
		        <view class="flex flex-x-center flex-y-center" style="width: 100%;height: 100%;position: fixed;left: 0;top: 0;" v-if="!data.qrcode_pic">
		            <view style="text-align: center;font-size: 9pt;color: #888">
		                <image :src="data.__wxapp_img.system.loading_black.url" style="width: 50upx;height: 50upx"></image>
		                <view>正在生成二维码</view>
		            </view>
		        </view>
		        <block v-else>
		            <view style="position: relative;text-align: center;padding-top: 140upx;margin-bottom: 80upx;z-index:10;">
		                <image class="header-bg" mode="widthFix" :src="data.header_bg" style="width: 100%;position: absolute;top: 0;left: 0;"></image>
		                <image class="shop-logo" :src="data.shop_logo" style="width: 200upx;height: 200upx;margin-bottom: 40upx;border-radius: 16upx;box-shadow: 0 0 16upx rgba(0,0,0,.2);position:relative;"></image>
		                <view>{{data.shop_name}}</view>
		            </view>
		            <view style="text-align: center">
		                <image :src="data.qrcode_pic" style="width: 400upx;height: 400upx;margin-bottom: 40upx;box-shadow: 0 0 4upx rgba(0,0,0,.05)"></image>
		                <view>扫一扫，进入店铺</view>
		            </view>
		        </block>
		    </view>
		    	<comp-footer v-bind="{data:data}"></comp-footer>
		</view>
		
	</view>
</template>

<script>var myVue = {};
	export default {
		data() {
			return {
				  data: {
				    qrcode_pic: ""
				}
			}
		},
		 onLoad: function(o) {myVue = this;
		    myVue.getApp.page.onLoad(this, o);
		    var e = this;
		    myVue.getApp.request({
		        url: e.getApp.api.store.user.shop_qrcode,
		        success: function(o) {
		            0 == o.code ? e.setData({
		                header_bg: o.data.header_bg,
		                shop_logo: o.data.shop_logo,
		                shop_name: o.data.shop_name,
		                qrcode_pic: o.data.qrcode_pic
		            }) : e.getApp.core.showModal({
		                title: "提示",
		                content: o.msg,
		                success: function() {}
		            });
		        }
		    });
		},
		onReady: function() {
		    myVue.getApp.page.onReady(this);
		},
		onShow: function() {
		    myVue.getApp.page.onShow(this);
		},
		onHide: function() {
		    myVue.getApp.page.onHide(this);
		},
		onUnload: function() {
		    myVue.getApp.page.onUnload(this);
		},
		onPullDownRefresh: function() {},
		onReachBottom: function() {}
	}
</script>

<style scoped>
page {
    background: #f7f7f7;
}
</style>
